package com.huawei.esdk.tp.device.smc.v100r002c01;

import com.huawei.esdk.platform.common.SDKErrorCode;
import com.huawei.esdk.platform.commu.itf.ICXFSOAPProtocolAdapter;
import com.huawei.esdk.platform.exception.ProtocolAdapterException;
import com.huawei.esdk.tp.device.smc.ConferenceControlCapabilityImpl;
import com.huawei.esdk.tp.southcommu.cxf.gen.v100r002c01.CancelBroadcast;
import com.huawei.esdk.tp.southcommu.cxf.gen.v100r002c01.CancelBroadcastResponse;
import com.huawei.esdk.tp.southcommu.cxf.gen.v100r002c01.ConferenceId;
import com.huawei.esdk.tp.southcommu.cxf.gen.v100r002c01.SmcExternal2Soap;

public class SMC20V1R2C01ConferenceControlCapabilityImpl extends
        ConferenceControlCapabilityImpl implements
        SMC20V1R2C01IConferenceControlCapability
{

    /** * @param cxfSoapProtocolAdapter */
    public SMC20V1R2C01ConferenceControlCapabilityImpl(
            ICXFSOAPProtocolAdapter cxfSOAPProtocolAdapter)
    {
        super(cxfSOAPProtocolAdapter);
    }

    protected String getSouthItfName()
    {
        return SmcExternal2Soap.class.getName();
    }

    /**
     * * @see com.huawei.esdk.tp.device.smc.v100r002c01.
     * SMC20V1R2C01IConferenceControlCapability
     * #cancelBroadcastSiteEx(java.lang.String, java.lang.String)
     */
    @Override
    public SDKErrorCode cancelBroadcastSiteEx(String id, String siteUri)
    {
        CancelBroadcast south = new CancelBroadcast();
        ConferenceId conferenceId = new ConferenceId();
        conferenceId.setConfInternalId(Long.valueOf(id));
        south.setConfId(conferenceId);
        
        south.setSiteUri(siteUri);
        CancelBroadcastResponse southResponse = null;
        SDKErrorCode result = new  SDKErrorCode();
        try
        {
            southResponse = (CancelBroadcastResponse) sendProtocolMessage(south,getSouthItfName(),
                    "cancelBroadcast");
            result.setErrCode(southResponse.getCancelBroadcastResult().getErrCode());
        }
        catch (ProtocolAdapterException e)
        {
            result.setErrCode(e.getErrorCode());
            return result;
        }

        return result;
    }

    @Override
    public SDKErrorCode cancelBroadcastContinuousPresenceEx(String id)
    { 
        CancelBroadcast south = new CancelBroadcast();
        ConferenceId conferenceId = new ConferenceId();
        conferenceId.setConfInternalId(Long.valueOf(id));
        south.setConfId(conferenceId);

        CancelBroadcastResponse southResponse = null;
        SDKErrorCode result = new  SDKErrorCode();
        try
        {
            southResponse = (CancelBroadcastResponse) sendProtocolMessage(south,getSouthItfName(),
                    "cancelBroadcast");
            result.setErrCode(southResponse.getCancelBroadcastResult().getErrCode());
        }
        catch (ProtocolAdapterException e)
        {
            result.setErrCode(e.getErrorCode());
            return result;
        }

        return result;
    }
}
